<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
  <xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>
  <!-- ========================= -->
  <!-- root element: projectteam -->
  <!-- ========================= -->
  <xsl:template match="EmailAuditTrail">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="simpleA4" page-height="210mm" page-width="297mm" margin-top="3mm" margin-bottom="3mm" margin-left="3mm" margin-right="3mm">
          <fo:region-body region-name="body" margin="10mm"/>
          <fo:region-after extent='10mm' region-name="footer"/>
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="simpleA4" font-family="simsun" language="zh">
      	<fo:static-content flow-name="footer">
	        <fo:block text-align-last="center" font-size="10pt">Page: <fo:page-number />
	        </fo:block>
		</fo:static-content>
        <fo:flow flow-name="body">
          <xsl:apply-templates select="MEMBER"/>
        </fo:flow>
        
      </fo:page-sequence>
    </fo:root>
    
  </xsl:template>

  <xsl:template match="MEMBER">
    <!-- Table for displaying the information of the applicant -->
    <fo:table table-layout="auto">
      <fo:table-column column-width="100%"/>
      <fo:table-body> 

        <fo:table-row height="30">
          <fo:table-cell>
		  <fo:block text-align="center" font-family="simsun"  font-weight="bold"  font-size="16pt">
			  Email Audit Trail Records
		  </fo:block>
          </fo:table-cell>
        </fo:table-row>

        <fo:table-row>
          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt">
            <fo:block text-align="center" font-family="simsun" font-size="12pt">
              Transaction Date:<xsl:value-of select="DATE"/>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>

    <!-- Table for displaying the information of the applicant -->
    <fo:table table-layout="fixed" language="zh_cn">
      <fo:table-column column-width="12mm"/>
      <fo:table-column column-width="20mm"/>
      <fo:table-column column-width="12mm"/>
      <fo:table-column column-width="38mm"/>
      <fo:table-column column-width="38mm"/>
      <fo:table-column column-width="30mm"/>
      <fo:table-column column-width="30mm"/>
      <fo:table-column column-width="30mm"/>
      <fo:table-column column-width="20mm"/>
      <fo:table-column column-width="40mm"/>
      <fo:table-body> 


	<!-- row spacer -->
	<fo:table-row height="3px">
          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-weight="bold" >
	    Code:
            </fo:block>
          </fo:table-cell>
          <fo:table-cell number-columns-spanned="2" padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	    <fo:block text-align="left" font-family="simsun">
	     <xsl:value-of select="BRANCHCODE"/>
            </fo:block>
          </fo:table-cell>
          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	     <fo:block text-align="left" font-family="simsun" font-weight="bold" >
          Name:
            </fo:block>
          </fo:table-cell>
          <fo:table-cell number-columns-spanned="7" padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	     <fo:block text-align="left" font-family="simsun">
            <xsl:value-of select="BRANCHNAME"/>
            </fo:block>
          </fo:table-cell>
	</fo:table-row>
        <!-- row spacer -->


	<!-- table head -->
	<fo:table-row height="3px">
          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-weight="bold" >
	    Type
            </fo:block>
          </fo:table-cell>
          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	    <fo:block text-align="left" font-family="simsun" font-weight="bold" >
	     Operation
            </fo:block>
          </fo:table-cell>
          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	     <fo:block text-align="left" font-family="simsun" font-weight="bold" >
             User
            </fo:block>
          </fo:table-cell>
          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	     <fo:block text-align="left" font-family="simsun" font-weight="bold" >
            From
            </fo:block>
          </fo:table-cell>
	   <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	     <fo:block text-align="left" font-family="simsun" font-weight="bold" >
            To
            </fo:block>
          </fo:table-cell>
          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	     <fo:block text-align="left" font-family="simsun" font-weight="bold" >
            Cc
            </fo:block>
          </fo:table-cell>
          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	     <fo:block text-align="left" font-family="simsun" font-weight="bold" >
            Bcc
            </fo:block>
          </fo:table-cell>
	  <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	     <fo:block text-align="left" font-family="simsun" font-weight="bold" >
            Subject
            </fo:block>
          </fo:table-cell>
	  <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	     <fo:block text-align="left" font-family="simsun" font-weight="bold" >
            SentDate
            </fo:block>
          </fo:table-cell>
	  <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
	     <fo:block text-align="left" font-family="simsun" font-weight="bold" >
            Attched
            </fo:block>
          </fo:table-cell>
	</fo:table-row>

     <xsl:for-each select="REPORT_RECORD">

	<fo:table-row height="6px">
          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-size="8pt">
	      <xsl:value-of select="EmailType"/>
            </fo:block>
          </fo:table-cell>

          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-size="8pt">
	      <xsl:value-of select="Operation"/>
            </fo:block>
          </fo:table-cell>

          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-size="8pt">
	      <xsl:value-of select="User"/>
            </fo:block>
          </fo:table-cell>

          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-size="8pt" wrap-option="wrap">
	      <xsl:value-of select="From"/>
            </fo:block>
          </fo:table-cell>

          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-size="8pt">
	      <xsl:value-of select="To"/>
            </fo:block>
          </fo:table-cell>

          <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-size="8pt">
	      <xsl:value-of select="Cc"/>
            </fo:block>
          </fo:table-cell>
	  <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-size="8pt">
	      <xsl:value-of select="Bcc"/>
            </fo:block>
          </fo:table-cell>
	  <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-size="8pt">
	      <xsl:value-of select="Subject"/>
            </fo:block>
          </fo:table-cell>
	  <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-size="8pt">
	      <xsl:value-of select="SentDateTime"/>
            </fo:block>
          </fo:table-cell>
	  <fo:table-cell padding-start="3pt" padding-end="3pt" padding-before="3pt" padding-after="3pt" border-style="solid" border-color="black" border-width="1pt">
             <fo:block text-align="left" font-family="simsun" font-size="8pt">
	      <xsl:value-of select="DocumentAttched"/>
            </fo:block>
          </fo:table-cell>
	</fo:table-row>
      </xsl:for-each>
        <!-- row spacer -->
      </fo:table-body>
    </fo:table>
   </xsl:template>

</xsl:stylesheet>
